#include "stdafx.h"
#include "iinmap.h"

IINMAP iinmap[] = {
    { ITEM_SN, VENDOR_SN_ID, "SN"},
    { ITEM_WIFI, VENDOR_WIFI_MAC_ID, "WIFI MAC"},
    { ITEM_LAN, VENDOR_LAN_MAC_ID, "LAN MAC"},
    { ITEM_BT, VENDOR_BLUETOOTH_ID, "BT MAC"},
    { ITEM_IMEI, VENDOR_IMEI_ID, "IMEI"},
    { ITEM_ID_ATTE, ITEM_ID_ATTE, "ATTE"},
    { -1, -1, NULL}
};

IINMAP *GetIINMAP(int index, int vendorid, const char *name)
{
    IINMAP *nmp = iinmap;

    while(nmp->index != -1 && nmp->vendorid != -1 && nmp->name != NULL) {
        if (index == nmp->index) {
            return nmp;
        } if (vendorid == nmp->vendorid) {
            return nmp;
        } if (name && !strcmp(nmp->name, name)) {
            return nmp;
        }
        nmp++;
    }
    return NULL;
}


void print_iinmap_info()
{
    IINMAP *nmp = iinmap;

    while(nmp->index != -1 && nmp->vendorid != -1 && nmp->name != NULL) {
        printf("userid:%02d; vendor id:%02d; name:%s\n", nmp->index, nmp->vendorid, nmp->name);

        nmp++;
    }
}